import { Order, TodayStats } from '../types/Dto/order';

// 模拟今日统计数据
export const fetchTodayStats = (): Promise<TodayStats> => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        totalOrders: 24,
        pendingOrders: 5,
        completedOrders: 18,
        totalRevenue: 5680.5,
      });
    }, 500);
  });
};

// 模拟获取今日订单
export const fetchTodayOrders = (): Promise<Order[]> => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve([
        {
          id: '1',
          orderNumber: 'ORD-2023-001',
          customerName: '张先生',
          totalAmount: 158.0,
          status: 'pending',
          items: [
            { name: '商品A', quantity: 2, price: 50 },
            { name: '商品B', quantity: 1, price: 58 },
          ],
          createdAt: '2023-05-15T09:30:00',
        },
        {
          id: '2',
          orderNumber: 'ORD-2023-002',
          customerName: '李女士',
          totalAmount: 320.0,
          status: 'pending',
          items: [
            { name: '商品C', quantity: 1, price: 120 },
            { name: '商品D', quantity: 4, price: 50 },
          ],
          createdAt: '2023-05-15T10:15:00',
        },
        {
          id: '3',
          orderNumber: 'ORD-2023-003',
          customerName: '王先生',
          totalAmount: 95.5,
          status: 'accepted',
          items: [{ name: '商品E', quantity: 1, price: 95.5 }],
          createdAt: '2023-05-15T11:20:00',
        },
      ]);
    }, 800);
  });
};

// 模拟接单操作
export const acceptOrder = (orderId: string): Promise<boolean> => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(true);
    }, 500);
  });
};
